package com.gticket.buyticket.mapper;

import com.gticket.buyticket.pojo.FilmSchedule;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FilmScheduleMapper {

    //获取单个电影的所有排片计划，根据日期分开｛｝
    @Select("select * from ${database}.filmschedule fs,${database}.cinemahall ch where ch.ch_id=fs.ch_id and fs_date=#{fs_date} and movie_id=#{movie_id} and fs.cinema_id=#{cinema_id}")
    public List<FilmSchedule> getFilmSchedule(FilmSchedule filmSchedule);

    //获取单个电影的总共会上映的所有日期
    @Select("select fs_date from ${database}.filmschedule where cinema_id=#{cinema_id} and movie_id=#{movie_id}")
    public List<String> getFilmDate(FilmSchedule filmSchedule);

    //获取单个电影的单个排片计划，根据cinema_id
    @Select("select * from ${database}.filmschedule fs,${database}.cinemahall ch where ch.ch_id=fs.ch_id and fs_id=#{fs_id} and fs.cinema_id=#{cinema_id}")
    public FilmSchedule getOneFilmSchedule(FilmSchedule filmSchedule);
}
